<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>用户登记</title>
  	<!-- 样 式 文 件 -->
		<link rel="stylesheet" href="component/pear/css/pear.css" />
		<!-- <link rel="stylesheet" href="admin/css/other/login.css" /> -->
  <!-- 依 赖 样 式 -->
  <link rel="stylesheet" href="./Pear-Admin-Layui-main/admin/css/other/login.css" />
  <!-- 加 载 样 式 -->
  <!-- <link rel="stylesheet" href="admin/css/loader.css" /> -->
  <link rel="stylesheet" href="./Pear-Admin-Layui-main/admin/css/loader.css" />
  <!-- 布 局 样 式 -->
  <link rel="stylesheet" href="./Pear-Admin-Layui-main/admin/css/admin.css" />
  <link rel="shortcut icon" href="记事本_notepad.png" type="image/x-icon">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="component/elementUI/index.css">
  <link rel="stylesheet" href="style/wangeditor.css">
  <link rel="stylesheet" href="style/index.css">

  <style>
    .title {
    font-size: 20px !important;
    font-weight: 550 !important;
    margin-left: 20px !important;
    color: #5FB878 !important;
    }
  </style>
</head>
    <body background="./Pear-Admin-Layui-main/admin/images/background.svg" style="background-size: cover;">
      <div id="app">
      <form class="layui-form" action="javascript:void(0);">
        <div class="layui-form-item">
          <img class="logo" src="log.png" />
          <div class="title">进入社区前请您先登陆</div>
          <div class="desc"></div>
          <!-- <span class="xin">进入社区前请您先登陆</span> -->
        </div>
        <div class="layui-form-item">
          <input placeholder="商 铺 名 称 : admin " lay-verify="required" hover class="layui-input" v-model="form.name" />
        </div>
        <div class="layui-form-item">
          <input placeholder="手 机 号 码 : admin " lay-verify="required" hover class="layui-input" v-model="form.pon" />
        </div>
        <div class="layui-form-item">
          <input placeholder="验证码 : "  hover  lay-verify="required" class="code layui-input layui-input-inline"  />
          <img src="./Pear-Admin-Layui-main/admin/images/captcha.gif" class="codeImage" />
        </div>
        <div class="layui-form-item">
          <input type="checkbox" name="" title="记住密码" lay-skin="primary" checked>
        </div>
        <div class="layui-form-item">
          <button type="button" class="pear-btn pear-btn-success login" lay-submit lay-filter="login" @click="deng()">
            登 入
          </button>
        </div>
      </form>
</body>

<script src="https://cdn.jsdelivr.net/npm/@svgdotjs/svg.js@3.0/dist/svg.min.js"></script>
<script type="text/javascript" src="utils/wangeditor.js"></script>
<script type="text/javascript" src="utils/jquery.min.js"></script>
<script src="jquery.qrcode.min.js"></script>
<script type="text/javascript" src="utils/jquery.cookie.js"></script>
<script type="text/javascript" src="utils/vue.min.js"></script>
<script type="text/javascript" src="utils/vuex.min.js"></script>
<script type="text/javascript" src="component/elementUI/index.js"></script>
<script type="text/javascript" src="component/component.js"></script>
<script type="text/javascript" src="config/config.js"></script>
<script type="text/javascript" src="utils/FileSaver.min.js"></script>
<script type="text/javascript" src="utils/FileSaver.js"></script>
<script type="text/javascript" src="utils/xlsx.full.min.js"></script>
<script type="text/javascript" src="utils/xlsx.core.min.js"></script>
<script type="text/javascript" src="utils/compressor.js"></script>
<script type="text/javascript" src="utils/ID_Validity.js"></script>
<!-- 资 源 引 入 -->
<script src="component/layui/layui.js"></script>
<script src="component/pear/pear.js"></script>
<script type="text/javascript" src="utils/utils.js"></script>
<script>
  layui.use(['form', 'button', 'popup'], function() {
				var form = layui.form;
				var button = layui.button;
				var popup = layui.popup;
				
                // 登 录 提 交
				form.on('submit(login)', function(data) {
					
					/// 验证
					
					/// 登录
					
					/// 动画
					button.load({
						elem: '.login',
						time: 1500,
						done: function() {
							popup.success("登录成功", function() {
								// location.href = "用户登记.html"
							});
						}
					})
					return false;
				});
			})
  var a = new Vue({
    el: '#app',
    data() {
      return{
        tableData:[],
        form:{
          id:'',
          name:'',
          pon:'',
        }
      }
    },
    mounted(){
      
      
    },
    methods: {
      handleSelect(key, keyPath) {
        console.log(key, keyPath)
      },
      deng(){

        $.ajax({
          headers:{
            'Content-Type':'application/x-www-form-urlencoded',
            Accesstoken:'eyJraWQiOiJteS1rZXktaWQiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiIxNTA0NjAwNjEyMCIsImF1ZCI6ImFwaS5leGFtcGxlLmNvbSIsImlzcyI6ImF1dGguZXhhbXBsZS5jb20iLCJVc2VySW5mbyI6eyJVc2VyTmFtZSI6IjE1MDQ2MDA2MTIwIn0sImV4cCI6MTczMTY1MDk3MywiaWF0IjoxNzMxNjQ3MzczLCJqdGkiOiIzNmY5NmJlMy0zMTU5LTQ4OWMtYjkwYy0zNzY1Y2E1MzBmMGUifQ.FVEI02R9l8dKwlrrUDJYjod1Rjs_YgA7WUmS9zj3D_-D1pG8fPoyJickgiZ2EZtMKvGM5W5aGFf1kxl-iubBEZLNmUFZOi-Z6N6YHkswcsHl2s2IeXCfONIzo8gqtcDcyNUtG9b4tV-0IuwPkcACF0-SODMKyLgkOl35Hi6T8CX5DlmXHtqkD5kbaNCDH_XgBxZc-yoNWKM9BAM-QErD7HZ3HD-8ypGBajhOM5H4_hau1oZ32YMmgBtkIuexcENc8Puk2eLP0iVAYsZw-0phwvOBxhsg9q_2yZ6L2vU8ykDGQFNkjhoxHfmV2dcuR_cBA-hzVUKOobMAAm9bCc6upw',
          },
          url: 'https://service2.ediblefungus.cn/zhaobo/generalBusiness/generalQueryByTableNameWithOriginal',
            type: 'POST',
            data:{       
              RowAmount: 10,            //  传给后台的参数
              Data:'tableData',
              Condition:"shen='已通过'"
          },
          success:(tableData)=>{
            console.log(tableData);
            
            console.log(this.form,'111');
            
            if (Array.isArray(tableData) && this.form && typeof this.form.name === 'string' && typeof this.form.pon === 'string') {
                for (let i = 0; i < tableData.length; i++) {
                    const item = tableData[i];
                    if (item && typeof item.name === 'string' && typeof item.pon === 'string' &&
                        item.name === this.form.name && item.pon === this.form.pon) {
                        console.log(item.id, 'id');
                        this.form.id = item.id
                        break;
                    }
                }
            } else {
                console.error('Invalid input data or context.');
            }


            // for(let i = 0; i < tableData.length; i++){
            //   console.log(tableData[i].id);
              
            //   if((tableData[i].name == this.form.name) && (tableData[i].pon == this.form.pon)){
            //     console.log(tableData[i].id,'id');
            //   }  
            // }



             // 现在可以安全地访问 this.form.id
        if (this.form.id) {
          const name = encodeURIComponent(this.form.name);
          const pon = encodeURIComponent(this.form.pon);
          const id = encodeURIComponent(this.form.id);
          const queryString = `?name=${name}&pon=${pon}&id=${id}`;
          window.location.href = './用户登记.html' + queryString;
        } else {
           window.location.href = './失败.html'
        }
            
          },
       })





        // console.log(this.form.id,'到底有没有');

        
        // const name = encodeURIComponent(this.form.name);
        // const pon = encodeURIComponent(this.form.pon);
        // const id = encodeURIComponent(this.form.id);
        // // 构建查询字符串
        // const queryString = `?name=${name}&pon=${pon}&id=${id}`;
        // console.log(1111);
        // console.log(queryString);
        // console.log(this.form);
        // window.location.href = './用户登记.html?'+queryString;
      }
  },
  })
</script>
</html>